﻿//*************************************************************************
// Revision log :
// Date	            Initials	    Description
// 2008-04-09       ricky.feng        First time create class. 
// 2018-06-28       ricky.feng        Update log4net version 2.0.8 
//particular recordation
// Copyright (c) 2007 Flex-Logic Limited.  All Rights Reserved.
//*************************************************************************
using System;
using System.Collections.Generic;
using System.Text;
using log4net;

namespace IESN.Tools
{
    public class LogHelper
    {

        private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        private static LogHelper _instance;

        /// <summary>
        /// Singleton to get LogHelper.
        /// </summary>
        public static LogHelper Instance
        {
            get
            {
                if (_instance == null)
                    _instance = new LogHelper();

                return _instance;
            }
        }

        private LogHelper()
        {
        }

        /// <summary>
        /// Logs down info message.
        /// </summary>
        /// <param name="message">Message.</param>
        public void Info(object message)
        {
            log.Info(message);
        }

        /// <summary>
        /// Logs down warn message
        /// </summary>
        /// <param name="message">Message.</param>
        public void Warn(object message)
        {
            log.Warn(message);
        }

        /// <summary>
        /// Logs down debug message
        /// </summary>
        /// <param name="message">Message.</param>
        public void Debug(object message)
        {
            log.Debug(message);
        }

        /// <summary>
        /// Logs down Error message.
        /// </summary>
        /// <param name="message">Message.</param>
        /// <param name="ex">Exception.</param>
        public void Error(object message, System.Exception ex)
        {
            log.Error(message, ex);
        }
    }
}


